<!DOCTYPE html>
<html>
<head>  
<meta charset="utf-8">
<title>修改评论 - {:config('web.WEB_AUT')}</title>
<meta name="keywords" content="{:config('web.WEB_KEY')}">
<meta name="description" content="{:config('web.WEB_DES')}">
{include file="forum/header"}
<link rel="stylesheet" href="__ADMIN__/wangEditor/css/wangEditor.min.css">
<script type="text/javascript" src="__ADMIN__/wangEditor/js/wangEditor.min.js"></script>
<style type="text/css">
.wangEditor-menu-container .menu-item a {padding: 12px 0;}
.wangEditor-menu-container .menu-item {height: 37px;width: 37px;}
.wangEditor-menu-container .menu-group {padding: 0;}
.wangEditor-container {border: 1px solid #e6e6e6;}
</style>
<div class="main layui-clear">
  <div class="fly-panel" pad20>
    <h2 class="page-title">修改评论</h2>
    <div class="layui-form layui-form-pane">
      <form method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$Comment.id}">
		    <div class="layui-form-item">
          <label for="L_title" class="layui-form-label">所属帖子</label>
          <div class="layui-input-block">
            <input type="text" value="{$Comment.title}" autocomplete="off" class="layui-input" disabled>
          </div>
        </div>
        <div class="layui-form-item layui-form-text">
          <div class="layui-input-block">
            <textarea id="textarea" name="content" lay-verify="layedit" style="height:400px;width: 100%;">{$Comment.content}</textarea>
          </div>
          <label for="L_content" class="layui-form-label" style="top: -2px;">内容</label>
        </div>
        <div class="layui-form-item">
          <button class="layui-btn" lay-submit="" lay-filter="comment_edit">立即发布</button>
        </div>
      </form>
    </div>
  </div>
</div>
{include file="forum/footer"}
<script type="text/javascript">
  var editor = new wangEditor('textarea');
	editor.config.uploadImgUrl = '{:url("index/comment/doUploadPic")}';
	editor.config.uploadImgFileName = 'FileName';
	editor.config.menus = [
      'bold',
      'underline',
      'italic',
      'strikethrough',
      'forecolor',
      'link',
      'unlink',
      'emotion',
      'img',
      'video',
      'insertcode',
	    'fullscreen',
    ];
	editor.config.pasteText = true;
  editor.create();
</script>
<script>
layui.use('form', function(){
  var form = layui.form()
  ,jq = layui.jquery;

  form.on('submit(comment_edit)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("index/comment/edit",array("id"=>$Comment.id))}',param,function(data){
      if(data.code == 200){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.href = '{:url("index/user/comment")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
})
</script>
</body>
</html>